home *** CD-ROM | disk | FTP | other *** search
- #pragma mark Header
- /***************************/
- /* SecondConsole.c
- This handles all functions to
- second console
- 6/5/91 - Created by Kirk Chase */
- /***************************/
-
- #pragma mark #includes
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <console.h>
- #include "DebugAids.h"
-
- #pragma mark Globals
- #ifdef THINK_C
- static FILE *printerConsole = NULL;
- #else
- static FILE *printerConsole = stdout;
- #endif
-
- PrintTestPage(short pageType)
- {
- short i;
-
- #ifdef THINK_C
- cshow(printerConsole);
- cecho2printer(printerConsole);
- #endif
-
- if (pageType == 1) {
- fprintf(printerConsole, " 1 2 3 4 5 6 7 8\n");
- fprintf(printerConsole, "12345678901234567890123456789012345678901234567890123456789012345678901234567890\n");
- for (i = 3; i<67; i++) fprintf(printerConsole,"%d\n", i);
- return;
- }
-
- fprintf(printerConsole,"\t\tTest Page 2\t\tpg. 1\n");
-
- #ifdef THINK_C
- cecho2printer(printerConsole); /* forces page break */
- #else
- fprintf(printerConsole, "\f");
- #endif
-
- fprintf(printerConsole,"\t\tTest Page 2\t\tpg. 2\n");
- }
-
- void ReadFile(short echo, FILE *con2)
- {
- char buffer[81];
- FILE *inputStream, *copyStream;
- short count;
-
- #ifdef THINK_C
- cshow(con2); /* bring console to the front */
- cgotoxy(1, 1, con2);
- ccleos(con2);
- #endif
-
- if (!(inputStream = fopen("Some Text", "r"))) { /* try to open input stream */
- fprintf(stderr, "\n*** Error *** Could not open file \"Some Text\"\n");
-
- #ifdef THINK_C
- chide(con2);
- #endif
- return;
- }
-
- if (echo)
- if(!(copyStream = fopen("Some Text Copy", "w")) ) {
- fprintf(stderr, "\n*** Error *** Could not open file \"Some Text Copy\"\n");
- #ifdef THINK_C
- chide(con2);
- #endif
- fclose(inputStream);
- return;
- }
-
- while(!feof(inputStream)) { /* get input from inputStream, write to console */
- count = fread(buffer, sizeof(char), 80, inputStream);
- fwrite(buffer, sizeof(char), count, copyStream);
- buffer[count] = '\0';
- fprintf(con2, "%s", buffer);
- }
- fprintf(con2, "\n");
- if (echo)
- fclose(copyStream);
- fclose(inputStream); /* close input stream */
- }
-
- SecondConsoleAd(FILE *con2)
- {
- #ifdef THINK_C
- cshow(con2);
- cgotoxy(1,1, con2);
- ccleos(con2);
-
- fprintf(con2, "⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø\n");
- fprintf(con2, "≥ Ansi Style Font ≥\n");
- fprintf(con2, "¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ\n");
- fprintf(con2, "\n");
- fprintf(con2, "€flflflflfl€ …=—=ª\n");
- fprintf(con2, "€∞YES∞€ ∫<≥>∫\n");
- fprintf(con2, "€‹‹‹‹‹€ »=œ=º\n");
- fprintf(con2, "\n");
-
- fprintf(con2, "Press mouse button to continue...\n");
- while(!Button());
- chide(con2);
- #else
- fprintf(con2, ">>>> Get A Mac <<<<\n");
- #endif
- }
-
- InitSecondConsole(FILE **con2)
- {
- short fnum;
- char consoleName[16]="\pSecond Console";
- char printerName[16]="\pPrinter Console";
- char pcFont[256] = "\ppcansi";
-
- #ifdef THINK_C
- console_options.title = consoleName;
- console_options.top +=10;
- console_options.left +=10;
- GetFNum((Str255 *) pcFont, &fnum);
- if (fnum)
- console_options.txFont = fnum;
- *con2 = fopenc();
- cinverse(FALSE, *con2);
-
- console_options.title = printerName;
- console_options.txFont = monaco;
- console_options.top +=10;
- console_options.left +=10;
-
- printerConsole = fopenc();
- chide(*con2);
- chide(printerConsole);
- #else
- *con2 = stdout;
- #endif
- }
-